package command;
import java.util.*;

import Exceptions.TableExistsException;
import XMLProcessing.DatabaseProcessing;
import XMLProcessing.TableProcessing;
public class CreateStatement implements IStatement{
	private String table_name;
	private ArrayList<String> fields;
	private String primaryKey;
	
	public CreateStatement(String table_name,ArrayList<String> fields,String primaryKey) {
		this.table_name = table_name;
		this.fields = fields;
		this.primaryKey = primaryKey;
	}
	
	public String toString() {
		String a =  "CREATE TABLE " + table_name + "(";
		for(String f : fields) {
			a += "f, \n";
		}
		a += ")";
		return a;
	}

	@Override
	public ResultNode eval() throws TableExistsException{
		System.out.println("aci3");
		TableProcessing.createTable(table_name, fields, primaryKey);
		return null;
	}
	
}
